import Vue from 'vue'
import ElementUI from 'element-ui'
import './styles/CssInit.css'
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue'
import router from './router/index.js'
import { timeChange } from './utils/tools.js'
import store from './store'
// 引入vuex
Vue.use(ElementUI)

Vue.config.productionTip = false

Vue.directive('ChangeTime', {
  // 自定义指令转换时间
  inserted: function (el) {
    el.innerText = timeChange(el.innerText)[0] + ':' + timeChange(el.innerText)[1]
  }
})
Vue.directive('ChangeDate', {
  // 自定义指令转换日期
  inserted: function (el) {
    let dt = new Date(Number(el.innerText))
    el.innerText = dt.getFullYear() + '.' + (dt.getMonth() <= 9 ? '0' + dt.getMonth() : dt.getMonth()) + '.' + (dt.getDate() <= 9 ? '0' + dt.getDate() : dt.getDate())
  }
})
new Vue({
  router: router,
  store: store,
  // 全局配置
  render: h => h(App),
}).$mount('#app')
